/**************
* corrections
**************/
function close_corr_summary() {
content = document.getElementById("corr_summary");
if(!content) return;
content.innerHTML = "";
content.parentNode.removeChild(content);
}
function scroll_to_correction(k){
var selectedPosX = 0;
var selectedPosY = 0;
var j=0;
for(var i=0; item=document.getElementsByTagName("span")[i]; i++) {
if(item.className=="coquille") {
j=j+1;
if(j==k){
element=item;
while(element != null){
selectedPosX += element.offsetLeft;
selectedPosY += element.offsetTop;
element = element.offsetParent;
}
window.scrollTo(selectedPosX,selectedPosY);
}
}
}
}
function pr_popup(){
corr_container = document.getElementById("corr_summary");
if(corr_container) { close_corr_summary(); return; }
corr_container = document.createElement("div");
corr_container.setAttribute("id","corr_summary");
var content=null;
for(var i=0; item=document.getElementsByTagName("span")[i]; i++) { if(item.className=="text") content=item; }
if(content) {
corr_container.style.cssText="position:relative;";
corr_container.innerHTML = "
"
content.insertBefore(corr_container,content.firstChild);
} else {
corr_container.style.cssText="position:fixed;min-width:16em;max-width:35em;max-height:35em;scroll:auto;right:0.5em;background:#ffffff;opacity:1;border:1px solid;padding:5px";
corr_container.innerHTML = self.corr_list;
content = document.getElementById("bodyContent");
content.insertBefore(corr_container,content.firstChild);
}
}
function pr_typos() {
if( ! ( wgNamespaceNumber==0 || self.proofreadPageViewURL ) ) return;
var message_title = {
'en':"List of corrections performed on this page" ,
'fr':"Liste des corrections apportées à cette page"
}
var message_link = {
'en':"Corrections" ,
'fr':"Coquilles"
}
var message_corr_1 = {
'en':"One typo has been corrected." ,
'fr':"Une coquille a été corrigée."
}
var message_corr = {
'en':" typos have been corrected." ,
'fr':" coquilles ont été corrigées."
}
var message_close = {
'en':"Close." ,
'fr':"Fermer."
}
var str = ''+message_title[wgContentLanguage] + " :
";
j=0;
for(var i=0; item=document.getElementsByTagName("span")[i]; i++) {
if(item.className=="coquille") {
j=j+1;
w1=w2='';
if(item.previousSibling) {
context1=item.previousSibling.data.split(' ');
if(context1.length>1) w1 = context1[context1.length - 2];
}
if(item.nextSibling) {
context2=item.nextSibling.data.split(' ');
if(context2.length>1) w2 = context2[1];
}
//hidden "m" char is to avoid rtl languages firefox bug
var newline = '- '+' « '+w1+' #pre# '+ w2 + ' » →m« ' + w1 + ' #post# ' + w2 +' »
';
newline = newline.replace("#pre#",item.title);
newline = newline.replace("#post#",item.innerHTML);
str = str + newline;
}}
str=str+'
'
self.corr_list = str;
if(j) {
var optlist = get_optlist();
optlist.innerHTML = optlist.innerHTML + ""+pr_msg(message_link)+" ("+j+")";
cs = document.getElementById("corr-info");
if(cs) {
if(j==1)
cs.innerHTML = " " + pr_msg(message_corr_1);
else
cs.innerHTML = " " + j + pr_msg(message_corr);
}
}
}
addOnloadHook(pr_typos);